#!/usr/bin
# ODS层数据同步脚本
# 用户行为日志导入
echo '=======================用户行为日志导入开始======================='
ST=$(date -d "1 days ago" +%Y%m%d)
hive -e "load data local inpath '/root/idea/01shop/04各层级调度脚本/01ods/000000_0' overwrite into table ods_nshop.ods_nshop_01_useractlog partition(bdp_day='$ST');"
echo '=======================用户行为日志导入结束======================='
# 外部数据导入
#sqoop import \
#--connect jdbc:mysql://qianfeng01:3306/nshop \
#--query "select customer_id,customer_login,customer_nickname,customer_name,customer_pass,customer_mobile,customer_idcard,customer_gender,customer_birthday,customer_age,customer_age_range,customer_email,customer_natives,customer_ctime,customer_utime,customer_device_num from customer where \$CONDITIONS" \
#--username root \
#--password 123456 \
#--target-dir /data/nshop/ods/ods_02_customer \
#--hive-import \
#--hive-database ods_nshop \
#--hive-table ods_02_customer \
#--delete-target-dir \
#-m 1
#
#sqoop import \
#--connect jdbc:mysql://qianfeng01:3306/nshop \
#--query "select customer_id,attention_id,attention_type,attention_status,attention_ctime from customer_attention where \$CONDITIONS" \
#--username root \
#--password 123456 \
#--target-dir /data/nshop/ods/ods_02_customer_attention \
#--hive-import \
#--hive-database ods_nshop \
#--hive-table ods_02_customer_attention \
#--delete-target-dir \
#-m 1
#
#sqoop import \
#--connect jdbc:mysql://qianfeng01:3306/nshop \
#--query "select consignee_id,customer_id,consignee_name,consignee_mobile,consignee_zipcode,consignee_addr,consignee_tag,ctime from customer_consignee where \$CONDITIONS" \
#--username root \
#--password 123456 \
#--target-dir /data/nshop/ods/ods_02_customer_consignee \
#--hive-import \
#--hive-database ods_nshop \
#--hive-table ods_02_customer_consignee \
#--delete-target-dir \
#-m 1
#
#sqoop import \
#--connect jdbc:mysql://qianfeng01:3306/nshop \
#--username root \
#--password 123456 \
#--query "select category_code,category_name,category_parent_id,category_status,category_utime from category where \$CONDITIONS" \
#--target-dir /data/nshop/ods/dim_pub_category \
#--hive-import \
#--hive-database ods_nshop \
#--hive-table dim_pub_category \
#--delete-target-dir \
#-m 1
#
#sqoop import \
#--connect jdbc:mysql://qianfeng01:3306/nshop \
#--username root \
#--password 123456 \
#--query "select supplier_code,supplier_name,supplier_type,supplier_status,supplier_utime from supplier where \$CONDITIONS" \
#--target-dir /data/nshop/ods/dim_pub_supplier \
#--hive-import \
#--hive-database ods_nshop \
#--hive-table dim_pub_supplier \
#--delete-target-dir \
#-m 1
#
#sqoop import \
#--connect jdbc:mysql://qianfeng01:3306/nshop \
#--username root \
#--password 123456 \
#--query "select order_id,customer_id,order_status,customer_ip,customer_longitude,customer_latitude,customer_areacode,consignee_name,consignee_mobile,consignee_zipcode,pay_type,pay_code,pay_nettype,district_money,shipping_money,payment_money,order_ctime,shipping_time,receive_time from orders where \$CONDITIONS" \
#--target-dir /data/nshop/ods/ods_02_orders \
#--hive-import \
#--hive-database ods_nshop \
#--hive-table ods_02_orders \
#--delete-target-dir \
#-m 1
#
#sqoop import \
#--connect jdbc:mysql://qianfeng01:3306/nshop \
#--username root \
#--password 123456 \
#--query "select order_detail_id,order_id,product_id,product_name,product_remark,product_cnt,product_price,weighing_cost,district_money,is_activity,order_detail_ctime from order_detail where \$CONDITIONS" \
#--target-dir /data/nshop/ods/ods_02_order_detail \
#--hive-import \
#--hive-database ods_nshop \
#--hive-table ods_02_order_detail \
#--delete-target-dir \
#-m 1
#
#sqoop import \
#--connect jdbc:mysql://qianfeng01:3306/nshop \
#--username root \
#--password 123456 \
#--query "select page_code,page_remark,page_type,page_target,page_ctime from page_dim where \$CONDITIONS" \
#--target-dir /data/nshop/ods/dim_pub_page \
#--hive-import \
#--hive-database ods_nshop \
#--hive-table dim_pub_page \
#--delete-target-dir \
#-m 1
#
#sqoop import \
#--connect jdbc:mysql://qianfeng01:3306/nshop \
#--username root \
#--password 123456 \
#--query "select region_code,region_code_desc,region_city,region_city_desc,region_province,region_province_desc from area_dim where \$CONDITIONS" \
#--target-dir /data/nshop/ods/dim_pub_area \
#--hive-import \
#--hive-database ods_nshop \
#--hive-table dim_pub_area \
#--delete-target-dir \
#-m 1
#
#sqoop import \
#--connect jdbc:mysql://qianfeng01:3306/nshop \
#--username root \
#--password 123456 \
#--query "select date_day,date_day_desc,date_day_month,date_day_year,date_day_en,date_week,date_week_desc,date_month,date_month_en,date_month_desc,date_quarter,date_quarter_en,date_quarter_desc,date_year from date_dim where \$CONDITIONS" \
#--target-dir /data/nshop/ods/dim_pub_date \
#--hive-import \
#--hive-database ods_nshop \
#--hive-table dim_pub_date \
#--delete-target-dir \
#-m 1
#
#sqoop import \
#--connect jdbc:mysql://qianfeng01:3306/nshop \
#--username root \
#--password 123456 \
#--query "select pay_id,order_id,customer_id,pay_status,pay_type,pay_code,pay_nettype,pay_amount,pay_ctime from orders_pay_records where \$CONDITIONS" \
#--target-dir /data/nshop/ods/ods_02_orders_pay_records \
#--hive-import \
#--hive-database ods_nshop \
#--hive-table ods_02_orders_pay_records \
#--delete-target-dir \
#-m 1
#
#sqoop import \
#--connect jdbc:mysql://qianfeng01:3306/nshop \
#--username root \
#--password 123456 \
#--query "select product_code,product_name,product_remark,category_code,supplier_code,product_price,product_weighing_cost,product_publish_status,product_audit_status,product_bar_code,product_weight,product_length,product_height,product_width,product_colors,product_date,product_shelf_life,product_ctime,product_utime from product where \$CONDITIONS" \
#--target-dir /data/nshop/ods/dim_pub_product \
#--hive-import \
#--hive-database ods_nshop \
#--hive-table dim_pub_product \
#--delete-target-dir \
#-m 1